import { init } from 'snabbdom/build/package/init'
import { h } from 'snabbdom/build/package/h'

import { styleModule } from 'snabbdom/build/package/modules/style'
import { eventListenersModule } from 'snabbdom/build/package/modules/eventlisteners'

const patch = init([styleModule, eventListenersModule])

let vnode = h('div', [
  h('h1', { style: { background: 'red' } }, 'hellow h2221'),
  h('p', { on: { click: eventHandler } }, '这是一个 222p')
])

function eventHandler() {
  console.log('eventHandler')
}

let app = document.querySelector('#app')
patch(app, vnode)